#pragma once

class TestCamera;

class AirScapeCamera
{
public:
	AirScapeCamera(void);
	~AirScapeCamera(void);

	const D3DXMATRIX*  GetViewMatrix() const { return &m_mView; }
    const D3DXMATRIX*  GetProjMatrix() const { return &m_mProj; }

	void  SetViewParams( const D3DXVECTOR3* pvEyePt, const D3DXVECTOR3* pvLookatPt );
    void  SetProjParams( FLOAT fFOV, FLOAT fAspect, FLOAT fNearPlane, FLOAT fFarPlane );

	const D3DXVECTOR3* GetPos(void) { return &m_vEye; }
	const D3DXVECTOR3* GetLookAt(void) { return &m_vLookAt; }

private:

	D3DXVECTOR3 m_vEye;                 // Camera eye position
    D3DXVECTOR3 m_vLookAt;              // LookAt position

	D3DXMATRIX m_mView;              // View matrix 
    D3DXMATRIX m_mProj;              // Projection matrix

	float m_fWidth;                 // Field of view
    float m_fHeight;              // Aspect ratio
    float m_fNearPlane;           // Near plane
    float m_fFarPlane;            // Far plane
};

class DebugAirScape
{
public:
	DebugAirScape(void);
	~DebugAirScape(void);

	bool Init( IDirect3DDevice9* pDevice );
	bool Draw( IDirect3DDevice9* pDevice, TestCamera* pChunkCamera );
	void UpdateCamera( const D3DXVECTOR3* pCameraPos );

	const AirScapeCamera& GetCamera() const;

	bool Reset( IDirect3DDevice9* pDevice );

private:

	void _DrawText(void);
	void _DrawIndicator( IDirect3DDevice9* pDevice, TestCamera* pChunkCamera );

private:

	LPDIRECT3DTEXTURE9 m_pRenderTarger;

	AirScapeCamera m_Camera;

	float m_fHeight;

	D3DSURFACE_DESC	m_rBBufferSurfaceDesc;

	ID3DXFont*   m_pFont;         // Font for drawing text
	ID3DXSprite* m_pTextSprite;   // Sprite for batching draw text calls
};

